package cn.yuanqiao.archive.identification.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 识别记录对象 YQ_IDENTIFICATION_RECORD
 *
 * @author xy
 * @date 2023-10-12
 */
public class IdentificationRecord extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    public static final String BIGTABLENAME = "_YQ_IDENTIFICATION_RECORD";
    public IdentificationRecord() {
        if(SecurityUtils.getLoginUser()!=null){
            String tenantCode = SecurityUtils.getTenantCode();
            if(StringUtils.isEmpty(tenantCode)){
                //  throw new ServiceException("TenantCode is null");
            }else {
                this.tableName = tenantCode.toUpperCase()+BIGTABLENAME;
            }
        }
    }

    /** id */
    @IdAnnotation
    private Long id;

    /** 件标题 */
    @Excel(name = "标题")
    private String title;
    /** 件档号 */
    @Excel(name = "档号")
    private String filesNo;
    /** 文件名称 */
    @Excel(name = "原文件名称")
    private String fileName;
    /** 原实际文件名称 */
    @Excel(name = "原实际文件名称")
    private String realFileName;


    /** 文件路径 */
    @Excel(name = "原文件路径")
    private String filePath;

    /** 新文件路径 */
    @Excel(name = "新文件路径")
    private String newFilePath;


    /** 原docId */
/*
    @Excel(name = "原docId")
*/
    private Long docId;

    /** 创建时间 */
    @Excel(name = "识别时间",dateFormat= "yyyy-MM-dd hh:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    /** 状态 */
    @Excel(name = "状态", readConverterExp = "0=失败,1=成功")
    private String state;


    @Excel(name = "失败原因")
    private String reason;

    /** 创建人 */
/*
    @Excel(name = "创建人")
*/
    private Long createId;

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }
    public void setFileName(String fileName)
    {
        this.fileName = fileName;
    }

    public String getFileName()
    {
        return fileName;
    }
    public void setFilePath(String filePath)
    {
        this.filePath = filePath;
    }

    public String getFilePath()
    {
        return filePath;
    }
    public void setNewFilePath(String newFilePath)
    {
        this.newFilePath = newFilePath;
    }

    public String getNewFilePath()
    {
        return newFilePath;
    }
    public void setDocId(Long docId)
    {
        this.docId = docId;
    }

    public Long getDocId()
    {
        return docId;
    }
    public void setState(String state)
    {
        this.state = state;
    }

    public String getState()
    {
        return state;
    }
    public void setCreateId(Long createId)
    {
        this.createId = createId;
    }

    public Long getCreateId()
    {
        return createId;
    }

    public String getRealFileName() {
        return realFileName;
    }

    public void setRealFileName(String realFileName) {
        this.realFileName = realFileName;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getFilesNo() {
        return filesNo;
    }

    public void setFilesNo(String filesNo) {
        this.filesNo = filesNo;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("fileName", getFileName())
                .append("filePath", getFilePath())
                .append("newFilePath", getNewFilePath())
                .append("docId", getDocId())
                .append("state", getState())
                .append("createTime", getCreateTime())
                .append("createId", getCreateId())
                .toString();
    }
}
